package cn.tedu;

import java.sql.*;
import java.util.Scanner;

public class Demo09 {
    public static void main(String[] args) {
        Scanner sc=new Scanner(System.in);
        System.out.println("请输入球员名称");
        String name=sc.nextLine();
        System.out.println("请输入球队名称");
        String team_name=sc.nextLine();
        try(Connection conn=DBUtils.getConn();){
            String sql="insert into player value(null,?,?)";
            //创建执行SQL语句对象
            PreparedStatement ps=conn.prepareStatement(sql);
            //替换?
            ps.setString(1,name);
            ps.setString(2,team_name);
            //执行
            ps.executeUpdate();
            System.out.println("添加成功");
        } catch (SQLException throwables) {
            throwables.printStackTrace();
        }
    }
}






